import { color } from './color.js';
import { logger } from './logger.js';
import { fork } from 'node:child_process';

let e=null,g;const N=Object.freeze({color:E,get:h,is:_});function d(o){const t=[color.blue,color.cyan,color.red,color.yellow,color.green,color.magenta],i=o.split("").reduce((l,r)=>l+r.charCodeAt(0),0);return t[i%t.length]}function v(o){o&&(e=o),!e&&process.env.NODE_ENV&&(e=process.env.NODE_ENV);const t=e?.split(",")?.flatMap(l=>l.split(" "))?.filter(Boolean)??[];logger.debug("Setting mode(s) to",t);let i=null;if(t.length>1){const l=t.reduce((r,c)=>r.length>c.length?r:c);i=()=>{t.forEach(r=>{const c=process.argv.slice(2),p=[];let f=!1;c.forEach(s=>{if(f&&s.startsWith("-"))f=!1;else if(f)return;p.push(s),(s==="--mode"||s==="-m")&&(p.push(s,r),f=!0);}),fork(process.argv[1],p,{env:{...process.env,ROBO_SHARD_MODE:r,ROBO_SHARD_MODES:t.join(","),ROBO_SHARD_LONGEST_MODE:l}}).on("exit",s=>{logger.debug(`Child process exited with code ${s}`);});});};}else g=d(e);return {shardModes:i}}function E(o){return g||(g=d(e)),g(o)}function h(){return !e&&process.env.NODE_ENV&&(e=process.env.NODE_ENV),e}function _(o){return h()===o}

export { N as Mode, E as colorMode, d as getModeColor, v as setMode };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=mode.js.map